import Vue from 'vue'
import VueRouter from 'vue-router'
//后台分工路由
import basis_router from './houtai/basis_router'
import finance_router from './houtai/finance_router'
import foods_router from './houtai/foods_router'
import inventry_router from './houtai/inventry_router'
import operate_router from './houtai/operate_router'
import system_router from './houtai/system_router'
//前台分工路由
import order_router from './qiantai/order_router'
import orderfoods_router from './qiantai/orderfoods_router'
import table_router from './qiantai/table_router'
import vip_router from './qiantai/vip_router'
import grxxRouter from './qiantai/grxx'
Vue.use(VueRouter)
const routes = [
 	{
 		path:'/login',
 		name:'login',
 		component:()=>import('@/views/login'),
 		meta:{
 			require:false,
 			roles:[1,2]
 		}
 	},
 	{
 		path:'/',
 		redirect:'/login'
 	},
 	{
 		path:'/index1',
 		name:'qiantaiIndex',
 		component:()=>import('@/views/qiantai/index'),
 		children:[
 			...order_router,
 			...orderfoods_router,
 			...table_router,
			 ...vip_router,
			 ...grxxRouter,
 			{
 				path:'/index1',
 				name:'orderfoods',
 				component:()=>import('@/views/qiantai/Dcxt'),
 				meta:{
 					require:true,
 					roles:[1]
 				}
 			}
 		],
 		meta:{
 			require:true,
 			roles:[1]
 		}
 	},
 	{
 		path:'/index2',
 		name:'houtaiIndex',
 		component:()=>import('@/views/houtai/index'),
 		children:[
 			...basis_router,
 			...finance_router,
 			...foods_router,
 			...inventry_router,
 			...operate_router,
 			...system_router,
 			{
 				path:'/index2',
 				name:'main',
 				component:()=>import('@/views/houtai/Main'),
 				meta:{
 					require:true,
 					roles:[2]
 				}
 			}
 		],
 		meta:{
 			require:true,
 			roles:[2]
 		}
 	}
]
//权限 1 员工 2 会计 3 普通管理员 4超级管理员
const router = new VueRouter({
  routes
})

export default router
